import { fly } from '@/utils/request';

const control = '/index/v1';

/**
 * 用户信息  => 获取用户的基础数据(余额,邀请码,是否能邀请,是否能够提现,收款人姓名)
 */
export function getInfo() {
  return fly.post(
    `${control}/iocrypt/info`,
    {},
    {
      type: 'encrypt',
      output: 'decrypt',
    }
  );
}

/**
 * 首页数据
 */
export function getCensus(type) {
  return fly.post(
    `${control}/census?type=` + type,
    {},
    { type: '', output: '' }
  );
}

/**
 * 置顶公告
 */
export function getTopNotice() {
  return fly.post(`${control}/notice/select`, {}, { type: '', output: '' });
}

/**
 * 初始化密码
 */
export function initPwd(passwd) {
  return fly.post(
    `${control}/passwd?passwd=` + passwd,
    {},
    { type: '', output: '' }
  );
}

/**
 * 版本号检查
 */
export function versionUpdate(version) {
  return fly.post(
    `${control}/oncrypt/version?version=` + version,
    {},
    { type: '', output: 'decrypt' }
  );
}
